//
// Created by sht on 2025/4/6.
//
#include <iostream>
#include <vector>
using namespace std;
class haoshu
{
    void test()
    {
        ios::sync_with_stdio(false); // 关闭C++流与C流的同步
        cin.tie(0); // 解除cin与cout的绑定
        int n;
        cin >> n;
        vector<bool> v(n + 1);
        int p = 1;
        int current_pow = 1;
        for (int i = 0; i <= n; ++i)
        {
            while (i >= current_pow * 10) { // 动态更新p和current_pow
                current_pow *= 10;
                ++p;
            }
            int head = i / current_pow;
            if (i < 10)
            {
                v[i] = i % 2 != 0;
            }
            else
            {
                v[i] = (head % 2 == p % 2) && v[i - head*current_pow];
            }
        }
        int sum = 0;
        for (auto e: v)
        {
            if (e)  ++sum;
        }
        cout << sum;
    }
};